using System;


namespace NUnitGrid.Framework.Env
{
    public class EnvironmentVariablesScope : IDisposable
    {
        private readonly IEnvironmentVariable[] variables;

        public EnvironmentVariablesScope(params IEnvironmentVariable[] variables)
        {
            this.variables = variables;

            foreach (var variable in variables)
            {
                variable.Set();
            }
        }

        void IDisposable.Dispose()
        {
            foreach (var variable in variables)
            {
                variable.Delete();
            }
        }
    }
}